package com.hddz.acquisition.dialog;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.hddz.acquisition.R;

public class BCConditionOperateDialog extends Activity implements OnClickListener{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.view_operate_bc_condition);
		((Button) this.findViewById(R.id.btn_operate_bc_ckwc)).setOnClickListener(this);
		((Button) this.findViewById(R.id.btn_operate_bc_ckyc)).setOnClickListener(this);
		((Button) this.findViewById(R.id.btn_operate_bc_ckqb)).setOnClickListener(this);
		((Button) this.findViewById(R.id.btn_operate_cancel)).setOnClickListener(this);
		//AndroidNFCApplication.getInstance().addActivity(this);
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		//AndroidNFCApplication.getInstance().removeActivity(this);
	}

	// 实现onTouchEvent触屏函数但点击屏幕时销毁本Activity
	@Override
	public boolean onTouchEvent(MotionEvent event) {
		finish();
		return true;
	}

	public void onClick(View v) {
		Intent intent = new Intent();
		switch (v.getId()) {
		case R.id.btn_operate_bc_ckwc:
			intent.putExtra("BCH", getIntent().getExtras().getString("BCH"));
			intent.putExtra("STATE", 0);
			setResult(RESULT_OK, intent);
			break;
		case R.id.btn_operate_bc_ckyc:
			intent.putExtra("BCH", getIntent().getExtras().getString("BCH"));
			intent.putExtra("STATE", 1);
			setResult(RESULT_OK, intent);
			break;
		case R.id.btn_operate_bc_ckqb:
			intent.putExtra("BCH", getIntent().getExtras().getString("BCH"));
			intent.putExtra("STATE", -1);
			setResult(RESULT_OK, intent);
			break;
		case R.id.btn_operate_cancel:
			setResult(RESULT_CANCELED, intent);
			break;
		}
		finish();
	}

}
